Skip to content

Conversation

@ncsokas
Copy link
Contributor

@ncsokas ncsokas commented Oct 23, 2025

This pull request introduces a hands-on lab for creating and using composite actions and reusable workflows in GitHub Actions. The main additions are a Python helper script for summarizing a list of numbers, step-by-step markdown guides for building a composite action around this script, and instructions for composing it into reusable workflows and consumer jobs. These changes provide practical examples for learning how to pass inputs/outputs between actions and workflows.

Composite Action and Python Helper:

  • Added ci/print_summary.py, a Python script that reads a JSON array of numbers and prints a summary (count, sum, average, min, max); includes error handling for input validation.
  • Added labs/composite-action.md, a lab guide explaining how to create a composite action that pipes numbers to the Python helper, exposes outputs, and is called from a workflow.

Reusable Workflow and Consumer Example:

  • Added labs/reusable-2.md, a lab guide for building a reusable workflow that calls the composite action, formats the summary output, and exposes both JSON and human-readable outputs. Includes example consumer workflow and tips for testing.

@ncsokas ncsokas requested a review from michaelin October 23, 2025 08:34
Copy link
Contributor

@michaelin michaelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of problems in the action and the workflows in the lab that causes the workflow to fail. They should be fixed.
For readability and to reduce the risk of copy paste errors, I'd also like the print_summary_text script extracted into a separate file.

Other than that, it could be nice if the exercices follow the same template as the other exercises. Given the time until the first run, that is not a blocker, though.

Copy link
Contributor

@michaelin michaelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've extracted the formatting script into a separate script. I also added a missing output from the reusable action. Other than that, I've mainly made some minor style updates.

@michaelin michaelin force-pushed the new-exercise/composite-reusable-actoin branch from a4177eb to f9e71e9 Compare November 4, 2025 09:39
@michaelin michaelin merged commit 9e7c72b into main Nov 4, 2025
@michaelin michaelin deleted the new-exercise/composite-reusable-actoin branch November 4, 2025 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants